package com.qiyu.dubbo.router.starter.zone.zk;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.registry.RegistryService;
import org.apache.dubbo.registry.zookeeper.ZookeeperRegistry;
import org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter;

/**
 * @Author idea
 * @Date created in 3:18 下午 2020/11/26
 */
@Slf4j
public class ZoneAwareZookeeperRegister extends ZookeeperRegistry {


    public ZoneAwareZookeeperRegister(URL url, ZookeeperTransporter zookeeperTransporter) {
        super(url, zookeeperTransporter);
    }

    @Override
    public void doRegister(URL url) {
        String zone = System.getProperty("git.branch");
        url = url.addParameter("git.branch", zone);
        log.info("当前注册的url为：{}" , url);
        super.doRegister(url);
    }
}
